#!/bin/bash

##https://nacos.io/zh-cn/docs/quick-start-docker.html
##https://github.com/nacos-group/nacos-docker/blob/master/example/standalone-mysql-8.yaml
##https://github.com/nacos-group/nacos-docker/blob/master/example/init.d/custom.properties

export basepath=$(readlink -f $(dirname $0))

##docker pull nacos/nacos-server:1.4.2
docker pull nacos/nacos-server:2.0.3
docker run -d --name nacos --restart=always \
-p 8848:8848 \
-p 9848:9848 \
-p 9555:9555 \
-v $basepath/standalone-logs/:/home/nacos/logs \
-v $basepath/init.d/custom.properties:/home/nacos/init.d/custom.properties \
-e PREFER_HOST_MODE=hostname \
-e MODE=standalone \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_SERVICE_HOST=mysql_nacos \
-e MYSQL_SERVICE_DB_NAME=nacos_devtest \
-e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD=123456 \
-e NACOS_AUTH_ENABLE=true \
--network=mynet \
nacos/nacos-server:2.0.3

##-e MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false \
##--ip 172.18.0.21 \
